/**
 * 在普通函数中，this指向：
 * 谁调用我默认指向谁，window.fn() this指向window
 */
function fn(){
    console.log(this);
}
fn()

const student = {
    name:"xiaowang",
    show:function(){
        console.log(this);
    }
}
student.show()

const student2 = {
    name:"xiaofeifei",
    play(){
        return function(){
            console.log(this);
        }
    }
}
const fun = student2.play()
fun()

//箭头函数中this默认指向父级作用域
const student3 = {
    name:"xiaofeifei",
    play:()=>{
        console.log(this);
    }
}
student3.play()

const student4 = {
    name:"xiaofeifei",
    play:()=>{
        return function(){
            console.log(this);
        }
    }
}
const res = student4.play()
res()

const student5 = {
    play:()=>{
        return ()=>{
            console.log(this);
        }
    }
}
student5.play()()  //window

const student6 = {
    play(){
        return ()=>{
            console.log(this);
        }
    }
}

student6.play()()

// odiv.onclick = function(){
//     console.log(this); //<div><div>
//     this.styles.color
// }
// class Cat{
//     constructor(id,name){
//         this.id = id
//         this.name = name
//     }
// }
// const cat = new Cat()


var m = 100